]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
workspaceAnimation: Use separate WorkspaceBackground class
authorFlorian Müllner <fmuellner@gnome.org>
Fri, 5 Dec 2025 09:06:32 +0000 (10:06 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Wed, 14 Jan 2026 18:07:57 +0000 (19:07 +0100)
Separating WorkspaceGroup and WorkspaceBackground allows each to
track its own set of windows without special-casing exceptions.

This will also give us more flexibility in the future, if we need
to reuse the background elsewhere. This may happen if we optionally
change the animation to a crossfade for the new `reduced-motion`
setting.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3995>
(cherry picked from commit b5e82f6e897fd081518020580ad73bb629bacf3f)

js/ui/workspaceAnimation.js

index 3c1e7d9165fdaef4bdcfc813ca2051f816d58965..7debd5ad42fb5a02db9585de14609f839167d128 100644 (file)
@@ -143,29 +143,33 @@ class WorkspaceGroup extends BaseWorkspaceGroup {
         if (!this._workspace)
             return;
 
-        this._background = new Meta.BackgroundGroup();
+        this._background = new WorkspaceBackground(this._workspace, this._monitor);
         this.add_child(this._background);
+    }
+});
+
+export const WorkspaceBackground = GObject.registerClass(
+class WorkspaceBackground extends BaseWorkspaceGroup {
+    _shouldShowWindow(window) {
+        return this._isDesktopWindow(window) &&
+            this._windowIsOnThisMonitor(window);
+    }
+
+    _createBackground() {
+        const background = new Meta.BackgroundGroup();
+        this.add_child(background);
 
         this._bgManager = new Background.BackgroundManager({
-            container: this._background,
+            container: background,
             monitorIndex: this._monitor.index,
             controlPosition: false,
         });
-        this._createDesktopWindows();
-    }
-
-    _createDesktopWindows() {
-        const desktopActors = global.get_window_actors().filter(w => {
-            return this._isDesktopWindow(w.meta_window) && this._windowIsOnThisMonitor(w.meta_window);
-        });
-        desktopActors.map(a => this._createClone(a)).forEach(clone => this._background.add_child(clone));
     }
 
     _onDestroy() {
         super._onDestroy();
 
-        if (this._workspace)
-            this._bgManager.destroy();
+        this._bgManager.destroy();
     }
 });